<%#
 Copyright 2008 Steven Barth <steven@midlink.org>
 Copyright 2008 Jo-Philipp Wich <jow@openwrt.org>
 Copyright 2012 David Menting <david@nut-bolt.nl>
 Copyright 2020 Lienol <lawlienol@gmail.com>
 Licensed to the public under the Apache License 2.0.
-%>

<%
	local ver = require "luci.version"
%>

   <footer>
    <a href="https://github.com/Lienol/openwrt-luci">Powered by <%= ver.luciname %> (<%= ver.luciversion %>)</a> / <%= ver.distversion %>
    <ul class="breadcrumb pull-right" id="modemenu" style="display:none"></ul>
   </footer>
  </div>
  <script type="text/javascript">L.require('menu-bootstrap')</script>
 </body>
</html>
<script>
	function addLoadEvent(func) {
		var oldonload = window.onload;
		if (typeof window.onload != 'function') {
			window.onload = func;
		} else {
			window.onload = function () {
				oldonload();
				func();
			}
		}
	}
	addLoadEvent(function(){
		var content = document.getElementsByName("content");
		var luci_username = document.getElementsByName("luci_username");
		var luci_password = document.getElementsByName("luci_password");
		if (content.length == 1 && luci_username.length == 1 && luci_password.length == 1) {
			//需要登录
			document.body.classList.add('node-main-login');
			luci_username[0].parentElement.parentElement.classList.add('luci_username_div');
			luci_username[0].parentElement.parentElement.children[0].style.display = "none";
			luci_password[0].parentElement.parentElement.classList.add('luci_password_div');
			luci_password[0].parentElement.parentElement.children[0].style.display = "none";
			
			var errorbox = document.getElementsByClassName("errorbox");
			var alert_message = document.getElementsByClassName("alert-message");
			if (errorbox.length == 1) {
				var tips = document.getElementsByClassName("cbi-map-descr");
				if (tips.length == 1) {
					tips[0].innerHTML = errorbox[0].innerHTML;
					tips[0].classList.add('errorbox');
					errorbox[0].style.display = "none";
				}
			} else if (alert_message.length == 1) {
				var tips = document.getElementsByClassName("cbi-map-descr");
				if (tips.length == 1) {
					tips[0].innerHTML = alert_message[0].innerHTML;
					tips[0].classList.add('errorbox');
					alert_message[0].style.display = "none";
				}
			}
		}
	});
</script>
</html>
